//
//  LYGuideTool.m
//  lottery
//
//  Created by 赵国腾的MacBook Pro on 16/6/27.
//  Copyright © 2016年 赵国腾. All rights reserved.
//

#import "LYGuideTool.h"
#import "LYSaveTool.h"
#import "LYTabBarController.h"
#import "LYNewFeatureViewController.h"

#define LYVersionKey @"LY_VersionKey"

@implementation LYGuideTool

+ (UIViewController *)chooseRootViewController {
    
    // 判断当前版本是否是新版本
    NSString *curVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"];
    
    NSString *oldVersion = [LYSaveTool objectForKey:LYVersionKey];
    
    UIViewController *rootVC = nil;
    if ([curVersion isEqualToString:oldVersion]) {
        
        // 没有更新版本
        rootVC = [[LYTabBarController alloc] init];
        
    }else {
        
        // 有最新版本
        rootVC = [[LYNewFeatureViewController alloc] init];
        [LYSaveTool setObject:curVersion forKey:LYVersionKey];
    }

    return rootVC;
}

@end
